package cn.shoukaiseki.sjf4j.fastjson;

import cn.shoukaiseki.sjf4j.node.JsonNodeType;
import cn.shoukaiseki.sjf4j.node.NumberType;
import cn.shoukaiseki.sjf4j.node.TreeNode;
import com.alibaba.fastjson2.JSONObject;

import java.util.Iterator;

public class FastjsonObjectNode extends FastjsonTreeNode<JSONObject> {

    public FastjsonObjectNode(JSONObject value) {
        super(value);
    }

    @Override
    public JsonNodeType getNodeType() {
        return JsonNodeType.OBJECT;
    }

    @Override
    public NumberType numberType() {
        return null;
    }


    @Override
    public TreeNode get(String fieldName) {
        return convert(value.get(fieldName));
    }

    @Override
    public TreeNode get(int index) {
        return null;
    }

    @Override
    public Iterator<String> fieldNames() {
        return value.keySet().iterator();
    }
}
